Add SILK noise shaping quantizer#164
Merged
Merged
Conversation
Co-authored-by: François Allais <francois.allais@hotmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #164 +/- ##
==========================================
+ Coverage 89.35% 89.61% +0.25%
==========================================
Files 47 48 +1
Lines 8851 9049 +198
==========================================
+ Hits 7909 8109 +200
+ Misses 707 706 -1
+ Partials 235 234 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
FrantaBOT
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
adds the non-delayed-decision noise-shaping quantizer (silk_NSQ_c, NSQ.c) — the core of the SILK encoder: short- and long-term prediction plus noise shaping applied to the scaled input, quantized to integer excitation pulses. Includes the state-scaling step (gain changes, LTP re-whitening) and the fixed-point LPC residual filter used for re-whitening
ported from
NSQ.c,NSQ.h, andLPC_analysis_filter.cfound one real bug while reviewing — not introduced during this split, it's in the original code, byte-identical extraction:
PredCoef_Q12is indexed with a stride ofmaxLPCOrder(24, matchingSILK_MAX_ORDER_LPC— a different, oversized constant used by the Schur/k2a analysis math), but libopus lays that buffer out in strides ofMAX_LPC_ORDER(16, define.h) — a distinct constant with a coincidentally-related name. It didn't show up in the existing smoke test because the test builds its ownpredCoefQ12buffer with the same (wrong) stride, so both sides were self-consistently wrong. It would only have broken once a real caller supplied a correctly-16-strided buffer in a later piece. AddedmaxPredictLPCOrder = 16and fixed both the indexing and the (harmless but also mislabeled) internal buffer-size constantalso added a voiced-signal test — the original only covered the unvoiced path, so
lpcAnalysisFilterFixed(the re-whitening filter) had zero coverage, and neither the LTP prediction nor the aggressive-RDO branch (lambdaQ10>2048) were reachable. Both files are at 100% coverage nowReference issue
part of the SILK encoder series (#161).